package com.qiujie.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qiujie.entity.ApproveRecord;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import java.util.List;

public interface ApproveRecordMapper extends BaseMapper<ApproveRecord> {

    /**
     * 批量插入审批记录
     */
    @Insert({
            "<script>",
            "INSERT INTO att_approve_record(leave_id, node_order, approver_id, status, remark) ",
            "VALUES ",
            "<foreach collection='records' item='item' separator=','>",
            "(#{item.leaveId}, #{item.nodeOrder}, #{item.approverId}, #{item.status}, #{item.remark})",
            "</foreach>",
            "</script>"
    })
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int batchInsert(@Param("records") List<ApproveRecord> records);
}
